const mongoose = require("../db/config")
// var mongoose = require('mongoose');
var Schema = mongoose.Schema;
const schema = new Schema({   //db中有一个Schema的构造函数 设置需要的字段格式
  // key: value 的设置
  name: {
    type: String, //类型首字母大写
    required: true  //定义必须存在
  },

  price: {//商品价格
    type: Number,
    default: 0  //默认为0
  },
  costPrice: {//成本价
    type: Number,
    default: 0
  },
  nums: {
    type: Number,
    default: 0
  }
});

module.exports = mongoose.model("Shop_info",schema)